
while True:
    print("如需退出，请输入0")
    TempStr = input("请输入带有符号的温度值：")
    if TempStr=='0':
        break
    else:
        if TempStr[-1] in ['F','f']:
            C=(eval(TempStr[0:-1])-32)/1.8
            print("转换后的温度是{:.2f}C".format(C))
        elif TempStr[-1] in ['C','c']:
            F = 1.8*eval(TempStr[0:-1])+32
            print("转换后的温度是{:.2f}F".format(F))
        elif TempStr[0] in ['F', 'f']:
            C = (eval(TempStr[1:]) - 32) / 1.8
            print("转换后的温度是C{:.2f}".format(C))
        elif TempStr[0] in ['C', 'c']:
            F = 1.8 * eval(TempStr[1:]) + 32
            print("转换后的温度是F{:.2f}".format(F))

        elif TempStr[-2:] in ['Fa', 'fa','FA','fA']:
            Ce = (eval(TempStr[0:-2]) - 32) / 1.8
            print("转换后的温度是{:.2f}Ce".format(Ce))
        elif TempStr[-2:] in ['Ce', 'ce','CE','cE']:
            Fa = 1.8*eval(TempStr[0:-2])+32
            print("转换后的温度是{:.2f}Fa".format(Fa))
        else:
            print("输入格式错误")
            '''
            '''